﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Reply.aspx.cs" Inherits="LizzabethBrownRealEstate.Views.Users.Reply" %>
<%@ Import Namespace="LizzabethBrownRealEstate.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
    <form id="frmRegister" method="post" action="<%= Url.Action("AddReply", "Users") %>" >

        <div class="contentDiv" style="margin-left:20%">
            <% LBRDataContext dc = new LBRDataContext(); %>
            <fieldset id="fldRegister" style="width:450px;">
                <legend>New Message</legend>
                <table>
                    <tr class="addPropertyRow">
                        <td class="addPropertyLabel"><label class="label" for="txtUserName">Topic:&nbsp;</label></td>
                        <td class="addPropertyField"><label><%= ViewData.Model.Title%></label></td>
                    </tr>
                    <tr class="addPropertyRow">
                        <td class="addPropertyLabel" style="vertical-align:top"><label class="label" for="txtFirst">Message:&nbsp;</label></td>
                        <td class="addPropertyField"><%= Html.TextArea("MessageText", "", new { style="height:100px; width: 350px" })%></td>
                    </tr>
                </table> 
                <%= Html.Hidden("TopicId", ViewData.Model.TopicId.ToString())%>
                <%= Html.Hidden("CreateDate", System.DateTime.Now)%>
                <%= Html.Hidden("CategoryId", ViewData.Model.CategoryId.ToString())%>
            </fieldset>
        
            <div style="margin-top:15px; margin-bottom:15px">
                <input type="submit" id="btnSubmit" name="btnSubmit" value="Submit" />
                <button onclick= "window.location='../Users.ashx/ViewTopic?topicId=<%=ViewData.Model.TopicId.ToString() %>'; return false;">Done</button>
            </div>
        </div>
    </form>
    <div class="MessageBoardSeparator">&nbsp;</div>
    <table class="MessageBoard">
        <% foreach (Message m in dc.GetMessagesByTopic(ViewData.Model.TopicId))
           { %>
        <% object messageId = new { messageId = m.MessageId }; %>
        <tr class="MessageRow">
            <td class="MessageText" style="padding-left:5px;"><%= m.MessageText%></td> 
            <td class="MessageDate"><%=m.CreateDate%></td>
            <td class="MessageUser"><%=dc.GetUser(m.UserId.ToString()).UserName%></td>
        </tr>
        <%} %>
    </table>
    
</asp:Content>
